home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / comm.swg / 0067_High Speed Modem Inits.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-26  |  1.5 KB  |  57 lines

  1. {
  2. > This is part of a procedure I use in my door to initialize the fossil
  3. > driver.  However, I need the CORRECT numbers for 38400 (1 only works on
  4. > some fossil drivers), 57600, and if anyone has it, 115200.  Can anyone
  5. > help?
  6.  
  7. Here's what I use..
  8. }
  9.  
  10. { To initialize the modem.. Not to be confused with PortOn }
  11. Procedure InitPort(Cp : word; Baud : Word; Charlength : byte; Parity : Char;
  12.                    StopBits: Byte);
  13. var temp : byte;
  14. Begin
  15.   comport := cp;
  16.   port := pred(cp);
  17.   temp := 0;  { Default of 19200 }
  18.  
  19.   Case Baud of           { 128, 64, 32... }
  20.     19200 : Temp := 0;   { 000____ }
  21.     38400 : Temp := 32;  { 001____ }
  22.     300   : Temp := 64;  { 010____ }
  23.     600   : temp := 96;  { 011____ }
  24.     1200  : Temp := 128; { 100_____ }
  25.     2400  : Temp := 160; { 101_____ }
  26.     4800  : Temp := 192; { 110_____ }
  27.     9600  : Temp := 224; { 111_____ }
  28.   End;
  29.   baudrate := baud;
  30.  
  31.   Case UpCase(Parity) of { 16, 8... }
  32. {   'N' :;               { ___00___ }
  33.     'O' : Inc(temp, 8);  { ___01___ }
  34.     'E' : Inc(temp, 24); { ___11___ }
  35.   End;
  36.                                      { 4... }
  37.   If StopBits = 2 then Inc(temp, 4); { _____1__ }
  38.   { If StopBits = 1 then ;           { _____0__ }
  39.  
  40.   Case CharLength of  { 2, 1. }
  41.     8 : inc(temp, 3); { ______11 }
  42.     7 : inc(temp, 2); { ______10 }
  43.   End;
  44.  
  45.   asm
  46.     mov ah, $00
  47.     mov al, temp
  48.     mov dx, port
  49.     int $14
  50.   end;
  51. End;
  52.  
  53. {
  54. I used the revision FOSSIL revision 5.0 specs to do that with.. And it works
  55. btw FOSSIL v5.0 specs don't mention 38400+ init's.
  56. }
  57.